package com.py.credit.dao;

import com.py.credit.entity.DynamicSqlEntity;
import org.apache.ibatis.annotations.Param;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @author tengt
 * @date 19/4/29 16:12
 */
public interface DynamicSqlDao {

    int insertTableInfo(DynamicSqlEntity entity);

    void updateTableInfo(@Param(value = "tableId") String tableId, @Param(value = "id") String id, @Param(value = "list") List<Map<String, Object>> list);

    void deleteTableInfo(@Param(value = "tableName") String tableName, @Param(value = "recordId") String recordId);

    LinkedHashMap<String, Object> selectTableInfoById(@Param(value = "tableId") String tableId, @Param(value = "id") String id, @Param(value = "mainName") String mainName);

    List<LinkedHashMap<String, Object>> selectStyleByTableInfo(@Param(value = "tableId") String tableId);

    List<LinkedHashMap<String, Object>> selectIndexInfoByTybm(@Param(value = "tableId") String tableId, @Param(value = "tybm") String tybm);

    List<LinkedHashMap<String, Object>> selectTableIdById(@Param(value = "list") String[] ids);

    List<LinkedHashMap<String, String>> selectMetricName(@Param(value = "ids") String ids);

    String selectTybmByMainName(@Param(value = "params") Map<String, String> params);

    /**
     * 功能描述: 动态插入表
     *
     * @param tableName 表名
     * @param status    新增数据状态
     * @param key       传入字段列表
     * @param list      传入字段值
     * @return int record_id
     * @author YaoS
     * @date 19/1/25 17:28
     */
    int dynamicInsertTable(
            @Param(value = "tableName") String tableName,
            @Param(value = "status") String status,
            @Param(value = "key") String key,
            @Param(value = "list") List<String> list);

    /**
     * 功能描述:回填申报法人数据
     *
     * @param tableName 表名
     * @param recordId  记录值
     * @param tybm      tybm
     * @author YaoS
     * @date 19/4/29 16:16
     */
    void backFillDataForFr(
            @Param(value = "tableName") String tableName,
            @Param(value = "recordId") int recordId,
            @Param(value = "tybm") String tybm);

    /**
     * 功能描述:回填申报自然人数据
     *
     * @param tableName 表名
     * @param recordId  记录值
     * @param tybm      tybm
     * @author YaoS
     * @date 19/4/29 16:16
     */
    void backFillDataForZrr(
            @Param(value = "tableName") String tableName,
            @Param(value = "recordId") int recordId,
            @Param(value = "tybm") String tybm);
}
